<!DOCTYPE HTML>
<html lang="en" >
    <!-- Start book Python数据分析课程讲义 -->
    <head>
        <!-- head:start -->
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>数据清洗、合并、转化和重构 | Python数据分析课程讲义</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        <meta name="author" content="BigCat">
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-tbfed-pagefooter/footer.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-splitter/splitter.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../../file/part03/3.9.html" />
    
    
    <link rel="prev" href="../../file/part03/3.7.html" />
    

        <!-- head:end -->
    </head>
    <body>
        <!-- body:start -->
        
    <div class="book"
        data-level="3.8"
        data-chapter-title="数据清洗、合并、转化和重构"
        data-filepath="file/part03/3.8.md"
        data-basepath="../.."
        data-revision="Thu Apr 27 2017 00:50:19 GMT+0800 (CST)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        传智播客Python学院数据分析
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="file/part01/1.html">
            
                
                    <a href="../../file/part01/1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        一、工作环境准备及数据分析建模理论基础
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="file/part01/1.1.html">
            
                
                    <a href="../../file/part01/1.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        Python 3.x新特性和编码回顾
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="file/part01/1.2.html">
            
                
                    <a href="../../file/part01/1.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        DIKW模型与数据工程
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="file/part01/1.3.html">
            
                
                    <a href="../../file/part01/1.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        数据分析建模理论基础
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="file/part02/2.html">
            
                
                    <a href="../../file/part02/2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        二、科学计算工具NumPy
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="file/part02/2.1.html">
            
                
                    <a href="../../file/part02/2.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        ndarray的创建与数据类型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="file/part02/2.2.html">
            
                
                    <a href="../../file/part02/2.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        ndarray的矩阵处理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="file/part02/2.3.html">
            
                
                    <a href="../../file/part02/2.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        ndarray的元素处理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="file/part02/2.4.html">
            
                
                    <a href="../../file/part02/2.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        实战案例：2016美国总统大选民意调查统计
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="file/part03/3.html">
            
                
                    <a href="../../file/part03/3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        三、数据分析工具Pandas
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="file/part03/3.1.html">
            
                
                    <a href="../../file/part03/3.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        Pandas的数据结构
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="file/part03/3.2.html">
            
                
                    <a href="../../file/part03/3.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        Pandas的索引操作
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="file/part03/3.3.html">
            
                
                    <a href="../../file/part03/3.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        Pandas的对齐运算
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="file/part03/3.4.html">
            
                
                    <a href="../../file/part03/3.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.4.</b>
                        
                        Pandas的函数应用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="file/part03/3.5.html">
            
                
                    <a href="../../file/part03/3.5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.5.</b>
                        
                        Pandas的层级索引
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="file/part03/3.6.html">
            
                
                    <a href="../../file/part03/3.6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.6.</b>
                        
                        Pandas统计计算和描述
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="file/part03/3.7.html">
            
                
                    <a href="../../file/part03/3.7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.7.</b>
                        
                        Pandas分组与聚合
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="3.8" data-path="file/part03/3.8.html">
            
                
                    <a href="../../file/part03/3.8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.8.</b>
                        
                        数据清洗、合并、转化和重构
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.9" data-path="file/part03/3.9.html">
            
                
                    <a href="../../file/part03/3.9.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.9.</b>
                        
                        聚类模型 -- K-Means介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.10" data-path="file/part03/3.10.html">
            
                
                    <a href="../../file/part03/3.10.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.10.</b>
                        
                        实战案例：全球食品数据分析
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="file/part04/4.html">
            
                
                    <a href="../../file/part04/4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        四、数据可视化工具
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="file/part04/4.1.html">
            
                
                    <a href="../../file/part04/4.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        Matplotlib绘图
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="file/part04/4.2.html">
            
                
                    <a href="../../file/part04/4.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        Seaborn绘图
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="file/part04/4.3.html">
            
                
                    <a href="../../file/part04/4.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.</b>
                        
                        Bokeh绘图
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="file/part04/4.4.html">
            
                
                    <a href="../../file/part04/4.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.</b>
                        
                        实战案例：世界高峰数据可视化
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="file/part06/6.html">
            
                
                    <a href="../../file/part06/6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        五、自然语言处理NLTK
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1" data-path="file/part06/6.1.html">
            
                
                    <a href="../../file/part06/6.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        NLTK与自然语言处理基础
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="file/part06/6.2.html">
            
                
                    <a href="../../file/part06/6.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        jieba分词
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="file/part06/6.3.html">
            
                
                    <a href="../../file/part06/6.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.</b>
                        
                        情感分析
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="file/part06/6.4.html">
            
                
                    <a href="../../file/part06/6.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.4.</b>
                        
                        文本相似度和分类
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.5" data-path="file/part06/6.6.html">
            
                
                    <a href="../../file/part06/6.6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.5.</b>
                        
                        实战案例：微博情感分析
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../" >Python数据分析课程讲义</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="&#x6570;&#x636E;&#x6E05;&#x6D17;">&#x6570;&#x636E;&#x6E05;&#x6D17;</h1>
<ul>
<li><p>&#x6570;&#x636E;&#x6E05;&#x6D17;&#x662F;&#x6570;&#x636E;&#x5206;&#x6790;&#x5173;&#x952E;&#x7684;&#x4E00;&#x6B65;&#xFF0C;&#x76F4;&#x63A5;&#x5F71;&#x54CD;&#x4E4B;&#x540E;&#x7684;&#x5904;&#x7406;&#x5DE5;&#x4F5C;</p>
</li>
<li><p>&#x6570;&#x636E;&#x9700;&#x8981;&#x4FEE;&#x6539;&#x5417;&#xFF1F;&#x6709;&#x4EC0;&#x4E48;&#x9700;&#x8981;&#x4FEE;&#x6539;&#x7684;&#x5417;&#xFF1F;&#x6570;&#x636E;&#x5E94;&#x8BE5;&#x600E;&#x4E48;&#x8C03;&#x6574;&#x624D;&#x80FD;&#x9002;&#x7528;&#x4E8E;&#x63A5;&#x4E0B;&#x6765;&#x7684;&#x5206;&#x6790;&#x548C;&#x6316;&#x6398;&#xFF1F;</p>
</li>
<li><p>&#x662F;&#x4E00;&#x4E2A;&#x8FED;&#x4EE3;&#x7684;&#x8FC7;&#x7A0B;&#xFF0C;&#x5B9E;&#x9645;&#x9879;&#x76EE;&#x4E2D;&#x53EF;&#x80FD;&#x9700;&#x8981;&#x4E0D;&#x6B62;&#x4E00;&#x6B21;&#x5730;&#x6267;&#x884C;&#x8FD9;&#x4E9B;&#x6E05;&#x6D17;&#x64CD;&#x4F5C;</p>
</li>
<li><p>&#x5904;&#x7406;&#x7F3A;&#x5931;&#x6570;&#x636E;&#xFF1A;pd.fillna()&#xFF0C;pd.dropna()</p>
</li>
</ul>
<blockquote>
<h2 id="&#x6570;&#x636E;&#x8FDE;&#x63A5;pdmerge">&#x6570;&#x636E;&#x8FDE;&#x63A5;(pd.merge)</h2>
</blockquote>
<ul>
<li><p>pd.merge</p>
</li>
<li><p>&#x6839;&#x636E;&#x5355;&#x4E2A;&#x6216;&#x591A;&#x4E2A;&#x952E;&#x5C06;&#x4E0D;&#x540C;DataFrame&#x7684;&#x884C;&#x8FDE;&#x63A5;&#x8D77;&#x6765;</p>
</li>
<li><p>&#x7C7B;&#x4F3C;&#x6570;&#x636E;&#x5E93;&#x7684;&#x8FDE;&#x63A5;&#x64CD;&#x4F5C;</p>
</li>
</ul>
<p>&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

df_obj1 = pd.DataFrame({<span class="hljs-string">&apos;key&apos;</span>: [<span class="hljs-string">&apos;b&apos;</span>, <span class="hljs-string">&apos;b&apos;</span>, <span class="hljs-string">&apos;a&apos;</span>, <span class="hljs-string">&apos;c&apos;</span>, <span class="hljs-string">&apos;a&apos;</span>, <span class="hljs-string">&apos;a&apos;</span>, <span class="hljs-string">&apos;b&apos;</span>],
                        <span class="hljs-string">&apos;data1&apos;</span> : np.random.randint(<span class="hljs-number">0</span>,<span class="hljs-number">10</span>,<span class="hljs-number">7</span>)})
df_obj2 = pd.DataFrame({<span class="hljs-string">&apos;key&apos;</span>: [<span class="hljs-string">&apos;a&apos;</span>, <span class="hljs-string">&apos;b&apos;</span>, <span class="hljs-string">&apos;d&apos;</span>],
                        <span class="hljs-string">&apos;data2&apos;</span> : np.random.randint(<span class="hljs-number">0</span>,<span class="hljs-number">10</span>,<span class="hljs-number">3</span>)})

print(df_obj1)
print(df_obj2)
</code></pre>
<p>&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code class="lang-python">   data1 key
   data1 key
<span class="hljs-number">0</span>      <span class="hljs-number">8</span>   b
<span class="hljs-number">1</span>      <span class="hljs-number">8</span>   b
<span class="hljs-number">2</span>      <span class="hljs-number">3</span>   a
<span class="hljs-number">3</span>      <span class="hljs-number">5</span>   c
<span class="hljs-number">4</span>      <span class="hljs-number">4</span>   a
<span class="hljs-number">5</span>      <span class="hljs-number">9</span>   a
<span class="hljs-number">6</span>      <span class="hljs-number">6</span>   b

   data2 key
<span class="hljs-number">0</span>      <span class="hljs-number">9</span>   a
<span class="hljs-number">1</span>      <span class="hljs-number">0</span>   b
<span class="hljs-number">2</span>      <span class="hljs-number">3</span>   d
</code></pre>
<h4 id="1-&#x9ED8;&#x8BA4;&#x5C06;&#x91CD;&#x53E0;&#x5217;&#x7684;&#x5217;&#x540D;&#x4F5C;&#x4E3A;&#x5916;&#x952E;&#x8FDB;&#x884C;&#x8FDE;&#x63A5;">1. &#x9ED8;&#x8BA4;&#x5C06;&#x91CD;&#x53E0;&#x5217;&#x7684;&#x5217;&#x540D;&#x4F5C;&#x4E3A;&#x201C;&#x5916;&#x952E;&#x201D;&#x8FDB;&#x884C;&#x8FDE;&#x63A5;</h4>
<p>&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># &#x9ED8;&#x8BA4;&#x5C06;&#x91CD;&#x53E0;&#x5217;&#x7684;&#x5217;&#x540D;&#x4F5C;&#x4E3A;&#x201C;&#x5916;&#x952E;&#x201D;&#x8FDB;&#x884C;&#x8FDE;&#x63A5;</span>
print(pd.merge(df_obj1, df_obj2))
</code></pre>
<p>&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code class="lang-python">   data1 key  data2
<span class="hljs-number">0</span>      <span class="hljs-number">8</span>   b      <span class="hljs-number">0</span>
<span class="hljs-number">1</span>      <span class="hljs-number">8</span>   b      <span class="hljs-number">0</span>
<span class="hljs-number">2</span>      <span class="hljs-number">6</span>   b      <span class="hljs-number">0</span>
<span class="hljs-number">3</span>      <span class="hljs-number">3</span>   a      <span class="hljs-number">9</span>
<span class="hljs-number">4</span>      <span class="hljs-number">4</span>   a      <span class="hljs-number">9</span>
<span class="hljs-number">5</span>      <span class="hljs-number">9</span>   a      <span class="hljs-number">9</span>
</code></pre>
<h4 id="2-on&#x663E;&#x793A;&#x6307;&#x5B9A;&#x5916;&#x952E;">2. on&#x663E;&#x793A;&#x6307;&#x5B9A;&#x201C;&#x5916;&#x952E;&#x201D;</h4>
<p>&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># on&#x663E;&#x793A;&#x6307;&#x5B9A;&#x201C;&#x5916;&#x952E;&#x201D;</span>
print(pd.merge(df_obj1, df_obj2, on=<span class="hljs-string">&apos;key&apos;</span>))
</code></pre>
<p>&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code class="lang-python">   data1 key  data2
<span class="hljs-number">0</span>      <span class="hljs-number">8</span>   b      <span class="hljs-number">0</span>
<span class="hljs-number">1</span>      <span class="hljs-number">8</span>   b      <span class="hljs-number">0</span>
<span class="hljs-number">2</span>      <span class="hljs-number">6</span>   b      <span class="hljs-number">0</span>
<span class="hljs-number">3</span>      <span class="hljs-number">3</span>   a      <span class="hljs-number">9</span>
<span class="hljs-number">4</span>      <span class="hljs-number">4</span>   a      <span class="hljs-number">9</span>
<span class="hljs-number">5</span>      <span class="hljs-number">9</span>   a      <span class="hljs-number">9</span>
</code></pre>
<h4 id="3-lefton&#xFF0C;&#x5DE6;&#x4FA7;&#x6570;&#x636E;&#x7684;&#x5916;&#x952E;&#xFF0C;righton&#xFF0C;&#x53F3;&#x4FA7;&#x6570;&#x636E;&#x7684;&#x5916;&#x952E;">3. left_on&#xFF0C;&#x5DE6;&#x4FA7;&#x6570;&#x636E;&#x7684;&#x201C;&#x5916;&#x952E;&#x201D;&#xFF0C;right_on&#xFF0C;&#x53F3;&#x4FA7;&#x6570;&#x636E;&#x7684;&#x201C;&#x5916;&#x952E;&#x201D;</h4>
<p>&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># left_on&#xFF0C;right_on&#x5206;&#x522B;&#x6307;&#x5B9A;&#x5DE6;&#x4FA7;&#x6570;&#x636E;&#x548C;&#x53F3;&#x4FA7;&#x6570;&#x636E;&#x7684;&#x201C;&#x5916;&#x952E;&#x201D;</span>

<span class="hljs-comment"># &#x66F4;&#x6539;&#x5217;&#x540D;</span>
df_obj1 = df_obj1.rename(columns={<span class="hljs-string">&apos;key&apos;</span>:<span class="hljs-string">&apos;key1&apos;</span>})
df_obj2 = df_obj2.rename(columns={<span class="hljs-string">&apos;key&apos;</span>:<span class="hljs-string">&apos;key2&apos;</span>})

print(pd.merge(df_obj1, df_obj2, left_on=<span class="hljs-string">&apos;key1&apos;</span>, right_on=<span class="hljs-string">&apos;key2&apos;</span>))
</code></pre>
<p>&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code class="lang-python">   data1 key1  data2 key2
<span class="hljs-number">0</span>      <span class="hljs-number">8</span>    b      <span class="hljs-number">0</span>    b
<span class="hljs-number">1</span>      <span class="hljs-number">8</span>    b      <span class="hljs-number">0</span>    b
<span class="hljs-number">2</span>      <span class="hljs-number">6</span>    b      <span class="hljs-number">0</span>    b
<span class="hljs-number">3</span>      <span class="hljs-number">3</span>    a      <span class="hljs-number">9</span>    a
<span class="hljs-number">4</span>      <span class="hljs-number">4</span>    a      <span class="hljs-number">9</span>    a
<span class="hljs-number">5</span>      <span class="hljs-number">9</span>    a      <span class="hljs-number">9</span>    a
</code></pre>
<blockquote>
<p>&#x9ED8;&#x8BA4;&#x662F;&#x201C;&#x5185;&#x8FDE;&#x63A5;&#x201D;(inner)&#xFF0C;&#x5373;&#x7ED3;&#x679C;&#x4E2D;&#x7684;&#x952E;&#x662F;&#x4EA4;&#x96C6;</p>
<p><code>how</code>&#x6307;&#x5B9A;&#x8FDE;&#x63A5;&#x65B9;&#x5F0F;</p>
</blockquote>
<h4 id="4-&#x5916;&#x8FDE;&#x63A5;outer&#xFF0C;&#x7ED3;&#x679C;&#x4E2D;&#x7684;&#x952E;&#x662F;&#x5E76;&#x96C6;">4. &#x201C;&#x5916;&#x8FDE;&#x63A5;&#x201D;(outer)&#xFF0C;&#x7ED3;&#x679C;&#x4E2D;&#x7684;&#x952E;&#x662F;&#x5E76;&#x96C6;</h4>
<p>&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># &#x201C;&#x5916;&#x8FDE;&#x63A5;&#x201D;</span>
print(pd.merge(df_obj1, df_obj2, left_on=<span class="hljs-string">&apos;key1&apos;</span>, right_on=<span class="hljs-string">&apos;key2&apos;</span>, how=<span class="hljs-string">&apos;outer&apos;</span>))
</code></pre>
<p>&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code class="lang-python">   data1 key1  data2 key2
<span class="hljs-number">0</span>    <span class="hljs-number">8.0</span>    b    <span class="hljs-number">0.0</span>    b
<span class="hljs-number">1</span>    <span class="hljs-number">8.0</span>    b    <span class="hljs-number">0.0</span>    b
<span class="hljs-number">2</span>    <span class="hljs-number">6.0</span>    b    <span class="hljs-number">0.0</span>    b
<span class="hljs-number">3</span>    <span class="hljs-number">3.0</span>    a    <span class="hljs-number">9.0</span>    a
<span class="hljs-number">4</span>    <span class="hljs-number">4.0</span>    a    <span class="hljs-number">9.0</span>    a
<span class="hljs-number">5</span>    <span class="hljs-number">9.0</span>    a    <span class="hljs-number">9.0</span>    a
<span class="hljs-number">6</span>    <span class="hljs-number">5.0</span>    c    NaN  NaN
<span class="hljs-number">7</span>    NaN  NaN    <span class="hljs-number">3.0</span>    d
</code></pre>
<h4 id="5-&#x5DE6;&#x8FDE;&#x63A5;left">5. &#x201C;&#x5DE6;&#x8FDE;&#x63A5;&#x201D;(left)</h4>
<p>&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># &#x5DE6;&#x8FDE;&#x63A5;</span>
print(pd.merge(df_obj1, df_obj2, left_on=<span class="hljs-string">&apos;key1&apos;</span>, right_on=<span class="hljs-string">&apos;key2&apos;</span>, how=<span class="hljs-string">&apos;left&apos;</span>))
</code></pre>
<p>&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code class="lang-python">   data1 key1  data2 key2
<span class="hljs-number">0</span>      <span class="hljs-number">8</span>    b    <span class="hljs-number">0.0</span>    b
<span class="hljs-number">1</span>      <span class="hljs-number">8</span>    b    <span class="hljs-number">0.0</span>    b
<span class="hljs-number">2</span>      <span class="hljs-number">3</span>    a    <span class="hljs-number">9.0</span>    a
<span class="hljs-number">3</span>      <span class="hljs-number">5</span>    c    NaN  NaN
<span class="hljs-number">4</span>      <span class="hljs-number">4</span>    a    <span class="hljs-number">9.0</span>    a
<span class="hljs-number">5</span>      <span class="hljs-number">9</span>    a    <span class="hljs-number">9.0</span>    a
<span class="hljs-number">6</span>      <span class="hljs-number">6</span>    b    <span class="hljs-number">0.0</span>    b
</code></pre>
<h4 id="6-&#x53F3;&#x8FDE;&#x63A5;right">6. &#x201C;&#x53F3;&#x8FDE;&#x63A5;&#x201D;(right)</h4>
<p>&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># &#x53F3;&#x8FDE;&#x63A5;</span>
print(pd.merge(df_obj1, df_obj2, left_on=<span class="hljs-string">&apos;key1&apos;</span>, right_on=<span class="hljs-string">&apos;key2&apos;</span>, how=<span class="hljs-string">&apos;right&apos;</span>))
</code></pre>
<p>&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code class="lang-python">   data1 key1  data2 key2
<span class="hljs-number">0</span>    <span class="hljs-number">8.0</span>    b      <span class="hljs-number">0</span>    b
<span class="hljs-number">1</span>    <span class="hljs-number">8.0</span>    b      <span class="hljs-number">0</span>    b
<span class="hljs-number">2</span>    <span class="hljs-number">6.0</span>    b      <span class="hljs-number">0</span>    b
<span class="hljs-number">3</span>    <span class="hljs-number">3.0</span>    a      <span class="hljs-number">9</span>    a
<span class="hljs-number">4</span>    <span class="hljs-number">4.0</span>    a      <span class="hljs-number">9</span>    a
<span class="hljs-number">5</span>    <span class="hljs-number">9.0</span>    a      <span class="hljs-number">9</span>    a
<span class="hljs-number">6</span>    NaN  NaN      <span class="hljs-number">3</span>    d
</code></pre>
<h4 id="7-&#x5904;&#x7406;&#x91CD;&#x590D;&#x5217;&#x540D;">7. &#x5904;&#x7406;&#x91CD;&#x590D;&#x5217;&#x540D;</h4>
<blockquote>
<p>suffixes&#xFF0C;&#x9ED8;&#x8BA4;&#x4E3A;_x, _y</p>
</blockquote>
<p>&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-python">
<span class="hljs-comment"># &#x5904;&#x7406;&#x91CD;&#x590D;&#x5217;&#x540D;</span>
df_obj1 = pd.DataFrame({<span class="hljs-string">&apos;key&apos;</span>: [<span class="hljs-string">&apos;b&apos;</span>, <span class="hljs-string">&apos;b&apos;</span>, <span class="hljs-string">&apos;a&apos;</span>, <span class="hljs-string">&apos;c&apos;</span>, <span class="hljs-string">&apos;a&apos;</span>, <span class="hljs-string">&apos;a&apos;</span>, <span class="hljs-string">&apos;b&apos;</span>],
                        <span class="hljs-string">&apos;data&apos;</span> : np.random.randint(<span class="hljs-number">0</span>,<span class="hljs-number">10</span>,<span class="hljs-number">7</span>)})
df_obj2 = pd.DataFrame({<span class="hljs-string">&apos;key&apos;</span>: [<span class="hljs-string">&apos;a&apos;</span>, <span class="hljs-string">&apos;b&apos;</span>, <span class="hljs-string">&apos;d&apos;</span>],
                        <span class="hljs-string">&apos;data&apos;</span> : np.random.randint(<span class="hljs-number">0</span>,<span class="hljs-number">10</span>,<span class="hljs-number">3</span>)})

print(pd.merge(df_obj1, df_obj2, on=<span class="hljs-string">&apos;key&apos;</span>, suffixes=(<span class="hljs-string">&apos;_left&apos;</span>, <span class="hljs-string">&apos;_right&apos;</span>)))
</code></pre>
<p>&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code class="lang-python">   data_left key  data_right
<span class="hljs-number">0</span>          <span class="hljs-number">9</span>   b           <span class="hljs-number">1</span>
<span class="hljs-number">1</span>          <span class="hljs-number">5</span>   b           <span class="hljs-number">1</span>
<span class="hljs-number">2</span>          <span class="hljs-number">1</span>   b           <span class="hljs-number">1</span>
<span class="hljs-number">3</span>          <span class="hljs-number">2</span>   a           <span class="hljs-number">8</span>
<span class="hljs-number">4</span>          <span class="hljs-number">2</span>   a           <span class="hljs-number">8</span>
<span class="hljs-number">5</span>          <span class="hljs-number">5</span>   a           <span class="hljs-number">8</span>
</code></pre>
<h4 id="8-&#x6309;&#x7D22;&#x5F15;&#x8FDE;&#x63A5;">8. &#x6309;&#x7D22;&#x5F15;&#x8FDE;&#x63A5;</h4>
<blockquote>
<p>left_index=True&#x6216;right_index=True</p>
</blockquote>
<p>&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-python">
<span class="hljs-comment"># &#x6309;&#x7D22;&#x5F15;&#x8FDE;&#x63A5;</span>
df_obj1 = pd.DataFrame({<span class="hljs-string">&apos;key&apos;</span>: [<span class="hljs-string">&apos;b&apos;</span>, <span class="hljs-string">&apos;b&apos;</span>, <span class="hljs-string">&apos;a&apos;</span>, <span class="hljs-string">&apos;c&apos;</span>, <span class="hljs-string">&apos;a&apos;</span>, <span class="hljs-string">&apos;a&apos;</span>, <span class="hljs-string">&apos;b&apos;</span>],
                        <span class="hljs-string">&apos;data1&apos;</span> : np.random.randint(<span class="hljs-number">0</span>,<span class="hljs-number">10</span>,<span class="hljs-number">7</span>)})
df_obj2 = pd.DataFrame({<span class="hljs-string">&apos;data2&apos;</span> : np.random.randint(<span class="hljs-number">0</span>,<span class="hljs-number">10</span>,<span class="hljs-number">3</span>)}, index=[<span class="hljs-string">&apos;a&apos;</span>, <span class="hljs-string">&apos;b&apos;</span>, <span class="hljs-string">&apos;d&apos;</span>])

print(pd.merge(df_obj1, df_obj2, left_on=<span class="hljs-string">&apos;key&apos;</span>, right_index=<span class="hljs-keyword">True</span>))
</code></pre>
<p>&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code class="lang-python">   data1 key  data2
<span class="hljs-number">0</span>      <span class="hljs-number">3</span>   b      <span class="hljs-number">6</span>
<span class="hljs-number">1</span>      <span class="hljs-number">4</span>   b      <span class="hljs-number">6</span>
<span class="hljs-number">6</span>      <span class="hljs-number">8</span>   b      <span class="hljs-number">6</span>
<span class="hljs-number">2</span>      <span class="hljs-number">6</span>   a      <span class="hljs-number">0</span>
<span class="hljs-number">4</span>      <span class="hljs-number">3</span>   a      <span class="hljs-number">0</span>
<span class="hljs-number">5</span>      <span class="hljs-number">0</span>   a      <span class="hljs-number">0</span>
</code></pre>
<blockquote>
<h2 id="&#x6570;&#x636E;&#x5408;&#x5E76;pdconcat">&#x6570;&#x636E;&#x5408;&#x5E76;(pd.concat)</h2>
</blockquote>
<ul>
<li>&#x6CBF;&#x8F74;&#x65B9;&#x5411;&#x5C06;&#x591A;&#x4E2A;&#x5BF9;&#x8C61;&#x5408;&#x5E76;&#x5230;&#x4E00;&#x8D77;</li>
</ul>
<h4 id="1-numpy&#x7684;concat">1. NumPy&#x7684;concat</h4>
<blockquote>
<p>np.concatenate</p>
</blockquote>
<p>&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd

arr1 = np.random.randint(<span class="hljs-number">0</span>, <span class="hljs-number">10</span>, (<span class="hljs-number">3</span>, <span class="hljs-number">4</span>))
arr2 = np.random.randint(<span class="hljs-number">0</span>, <span class="hljs-number">10</span>, (<span class="hljs-number">3</span>, <span class="hljs-number">4</span>))

print(arr1)
print(arr2)

print(np.concatenate([arr1, arr2]))
print(np.concatenate([arr1, arr2], axis=<span class="hljs-number">1</span>))
</code></pre>
<p>&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># print(arr1)</span>
[[<span class="hljs-number">3</span> <span class="hljs-number">3</span> <span class="hljs-number">0</span> <span class="hljs-number">8</span>]
 [<span class="hljs-number">2</span> <span class="hljs-number">0</span> <span class="hljs-number">3</span> <span class="hljs-number">1</span>]
 [<span class="hljs-number">4</span> <span class="hljs-number">8</span> <span class="hljs-number">8</span> <span class="hljs-number">2</span>]]

<span class="hljs-comment"># print(arr2)</span>
[[<span class="hljs-number">6</span> <span class="hljs-number">8</span> <span class="hljs-number">7</span> <span class="hljs-number">3</span>]
 [<span class="hljs-number">1</span> <span class="hljs-number">6</span> <span class="hljs-number">8</span> <span class="hljs-number">7</span>]
 [<span class="hljs-number">1</span> <span class="hljs-number">4</span> <span class="hljs-number">7</span> <span class="hljs-number">1</span>]]

<span class="hljs-comment"># print(np.concatenate([arr1, arr2]))</span>
 [[<span class="hljs-number">3</span> <span class="hljs-number">3</span> <span class="hljs-number">0</span> <span class="hljs-number">8</span>]
 [<span class="hljs-number">2</span> <span class="hljs-number">0</span> <span class="hljs-number">3</span> <span class="hljs-number">1</span>]
 [<span class="hljs-number">4</span> <span class="hljs-number">8</span> <span class="hljs-number">8</span> <span class="hljs-number">2</span>]
 [<span class="hljs-number">6</span> <span class="hljs-number">8</span> <span class="hljs-number">7</span> <span class="hljs-number">3</span>]
 [<span class="hljs-number">1</span> <span class="hljs-number">6</span> <span class="hljs-number">8</span> <span class="hljs-number">7</span>]
 [<span class="hljs-number">1</span> <span class="hljs-number">4</span> <span class="hljs-number">7</span> <span class="hljs-number">1</span>]]

<span class="hljs-comment"># print(np.concatenate([arr1, arr2], axis=1)) </span>
[[<span class="hljs-number">3</span> <span class="hljs-number">3</span> <span class="hljs-number">0</span> <span class="hljs-number">8</span> <span class="hljs-number">6</span> <span class="hljs-number">8</span> <span class="hljs-number">7</span> <span class="hljs-number">3</span>]
 [<span class="hljs-number">2</span> <span class="hljs-number">0</span> <span class="hljs-number">3</span> <span class="hljs-number">1</span> <span class="hljs-number">1</span> <span class="hljs-number">6</span> <span class="hljs-number">8</span> <span class="hljs-number">7</span>]
 [<span class="hljs-number">4</span> <span class="hljs-number">8</span> <span class="hljs-number">8</span> <span class="hljs-number">2</span> <span class="hljs-number">1</span> <span class="hljs-number">4</span> <span class="hljs-number">7</span> <span class="hljs-number">1</span>]]
</code></pre>
<h4 id="2-pdconcat">2. pd.concat</h4>
<ul>
<li><p>&#x6CE8;&#x610F;&#x6307;&#x5B9A;&#x8F74;&#x65B9;&#x5411;&#xFF0C;&#x9ED8;&#x8BA4;axis=0</p>
</li>
<li><p>join&#x6307;&#x5B9A;&#x5408;&#x5E76;&#x65B9;&#x5F0F;&#xFF0C;&#x9ED8;&#x8BA4;&#x4E3A;outer</p>
</li>
<li><p>Series&#x5408;&#x5E76;&#x65F6;&#x67E5;&#x770B;&#x884C;&#x7D22;&#x5F15;&#x6709;&#x65E0;&#x91CD;&#x590D;</p>
</li>
</ul>
<h5 id="1-index-&#x6CA1;&#x6709;&#x91CD;&#x590D;&#x7684;&#x60C5;&#x51B5;">1) index &#x6CA1;&#x6709;&#x91CD;&#x590D;&#x7684;&#x60C5;&#x51B5;</h5>
<p>&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># index &#x6CA1;&#x6709;&#x91CD;&#x590D;&#x7684;&#x60C5;&#x51B5;</span>
ser_obj1 = pd.Series(np.random.randint(<span class="hljs-number">0</span>, <span class="hljs-number">10</span>, <span class="hljs-number">5</span>), index=range(<span class="hljs-number">0</span>,<span class="hljs-number">5</span>))
ser_obj2 = pd.Series(np.random.randint(<span class="hljs-number">0</span>, <span class="hljs-number">10</span>, <span class="hljs-number">4</span>), index=range(<span class="hljs-number">5</span>,<span class="hljs-number">9</span>))
ser_obj3 = pd.Series(np.random.randint(<span class="hljs-number">0</span>, <span class="hljs-number">10</span>, <span class="hljs-number">3</span>), index=range(<span class="hljs-number">9</span>,<span class="hljs-number">12</span>))

print(ser_obj1)
print(ser_obj2)
print(ser_obj3)

print(pd.concat([ser_obj1, ser_obj2, ser_obj3]))
print(pd.concat([ser_obj1, ser_obj2, ser_obj3], axis=<span class="hljs-number">1</span>))
</code></pre>
<p>&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># print(ser_obj1)</span>
<span class="hljs-number">0</span>    <span class="hljs-number">1</span>
<span class="hljs-number">1</span>    <span class="hljs-number">8</span>
<span class="hljs-number">2</span>    <span class="hljs-number">4</span>
<span class="hljs-number">3</span>    <span class="hljs-number">9</span>
<span class="hljs-number">4</span>    <span class="hljs-number">4</span>
dtype: int64

<span class="hljs-comment"># print(ser_obj2)</span>
<span class="hljs-number">5</span>    <span class="hljs-number">2</span>
<span class="hljs-number">6</span>    <span class="hljs-number">6</span>
<span class="hljs-number">7</span>    <span class="hljs-number">4</span>
<span class="hljs-number">8</span>    <span class="hljs-number">2</span>
dtype: int64

<span class="hljs-comment"># print(ser_obj3)</span>
<span class="hljs-number">9</span>     <span class="hljs-number">6</span>
<span class="hljs-number">10</span>    <span class="hljs-number">2</span>
<span class="hljs-number">11</span>    <span class="hljs-number">7</span>
dtype: int64

<span class="hljs-comment"># print(pd.concat([ser_obj1, ser_obj2, ser_obj3]))</span>
<span class="hljs-number">0</span>     <span class="hljs-number">1</span>
<span class="hljs-number">1</span>     <span class="hljs-number">8</span>
<span class="hljs-number">2</span>     <span class="hljs-number">4</span>
<span class="hljs-number">3</span>     <span class="hljs-number">9</span>
<span class="hljs-number">4</span>     <span class="hljs-number">4</span>
<span class="hljs-number">5</span>     <span class="hljs-number">2</span>
<span class="hljs-number">6</span>     <span class="hljs-number">6</span>
<span class="hljs-number">7</span>     <span class="hljs-number">4</span>
<span class="hljs-number">8</span>     <span class="hljs-number">2</span>
<span class="hljs-number">9</span>     <span class="hljs-number">6</span>
<span class="hljs-number">10</span>    <span class="hljs-number">2</span>
<span class="hljs-number">11</span>    <span class="hljs-number">7</span>
dtype: int64

<span class="hljs-comment"># print(pd.concat([ser_obj1, ser_obj2, ser_obj3], axis=1))</span>
      <span class="hljs-number">0</span>    <span class="hljs-number">1</span>    <span class="hljs-number">2</span>
<span class="hljs-number">0</span>   <span class="hljs-number">1.0</span>  NaN  NaN
<span class="hljs-number">1</span>   <span class="hljs-number">5.0</span>  NaN  NaN
<span class="hljs-number">2</span>   <span class="hljs-number">3.0</span>  NaN  NaN
<span class="hljs-number">3</span>   <span class="hljs-number">2.0</span>  NaN  NaN
<span class="hljs-number">4</span>   <span class="hljs-number">4.0</span>  NaN  NaN
<span class="hljs-number">5</span>   NaN  <span class="hljs-number">9.0</span>  NaN
<span class="hljs-number">6</span>   NaN  <span class="hljs-number">8.0</span>  NaN
<span class="hljs-number">7</span>   NaN  <span class="hljs-number">3.0</span>  NaN
<span class="hljs-number">8</span>   NaN  <span class="hljs-number">6.0</span>  NaN
<span class="hljs-number">9</span>   NaN  NaN  <span class="hljs-number">2.0</span>
<span class="hljs-number">10</span>  NaN  NaN  <span class="hljs-number">3.0</span>
<span class="hljs-number">11</span>  NaN  NaN  <span class="hljs-number">3.0</span>
</code></pre>
<h5 id="2-index-&#x6709;&#x91CD;&#x590D;&#x7684;&#x60C5;&#x51B5;">2) index &#x6709;&#x91CD;&#x590D;&#x7684;&#x60C5;&#x51B5;</h5>
<p>&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># index &#x6709;&#x91CD;&#x590D;&#x7684;&#x60C5;&#x51B5;</span>
ser_obj1 = pd.Series(np.random.randint(<span class="hljs-number">0</span>, <span class="hljs-number">10</span>, <span class="hljs-number">5</span>), index=range(<span class="hljs-number">5</span>))
ser_obj2 = pd.Series(np.random.randint(<span class="hljs-number">0</span>, <span class="hljs-number">10</span>, <span class="hljs-number">4</span>), index=range(<span class="hljs-number">4</span>))
ser_obj3 = pd.Series(np.random.randint(<span class="hljs-number">0</span>, <span class="hljs-number">10</span>, <span class="hljs-number">3</span>), index=range(<span class="hljs-number">3</span>))

print(ser_obj1)
print(ser_obj2)
print(ser_obj3)

print(pd.concat([ser_obj1, ser_obj2, ser_obj3]))
</code></pre>
<p>&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># print(ser_obj1)</span>
<span class="hljs-number">0</span>    <span class="hljs-number">0</span>
<span class="hljs-number">1</span>    <span class="hljs-number">3</span>
<span class="hljs-number">2</span>    <span class="hljs-number">7</span>
<span class="hljs-number">3</span>    <span class="hljs-number">2</span>
<span class="hljs-number">4</span>    <span class="hljs-number">5</span>
dtype: int64

<span class="hljs-comment"># print(ser_obj2)</span>
<span class="hljs-number">0</span>    <span class="hljs-number">5</span>
<span class="hljs-number">1</span>    <span class="hljs-number">1</span>
<span class="hljs-number">2</span>    <span class="hljs-number">9</span>
<span class="hljs-number">3</span>    <span class="hljs-number">9</span>
dtype: int64

<span class="hljs-comment"># print(ser_obj3)</span>
<span class="hljs-number">0</span>    <span class="hljs-number">8</span>
<span class="hljs-number">1</span>    <span class="hljs-number">7</span>
<span class="hljs-number">2</span>    <span class="hljs-number">9</span>
dtype: int64

<span class="hljs-comment"># print(pd.concat([ser_obj1, ser_obj2, ser_obj3]))</span>
<span class="hljs-number">0</span>    <span class="hljs-number">0</span>
<span class="hljs-number">1</span>    <span class="hljs-number">3</span>
<span class="hljs-number">2</span>    <span class="hljs-number">7</span>
<span class="hljs-number">3</span>    <span class="hljs-number">2</span>
<span class="hljs-number">4</span>    <span class="hljs-number">5</span>
<span class="hljs-number">0</span>    <span class="hljs-number">5</span>
<span class="hljs-number">1</span>    <span class="hljs-number">1</span>
<span class="hljs-number">2</span>    <span class="hljs-number">9</span>
<span class="hljs-number">3</span>    <span class="hljs-number">9</span>
<span class="hljs-number">0</span>    <span class="hljs-number">8</span>
<span class="hljs-number">1</span>    <span class="hljs-number">7</span>
<span class="hljs-number">2</span>    <span class="hljs-number">9</span>
dtype: int64

<span class="hljs-comment"># print(pd.concat([ser_obj1, ser_obj2, ser_obj3], axis=1, join=&apos;inner&apos;)) </span>
<span class="hljs-comment"># join=&apos;inner&apos; &#x5C06;&#x53BB;&#x9664;NaN&#x6240;&#x5728;&#x7684;&#x884C;&#x6216;&#x5217;</span>
   <span class="hljs-number">0</span>  <span class="hljs-number">1</span>  <span class="hljs-number">2</span>
<span class="hljs-number">0</span>  <span class="hljs-number">0</span>  <span class="hljs-number">5</span>  <span class="hljs-number">8</span>
<span class="hljs-number">1</span>  <span class="hljs-number">3</span>  <span class="hljs-number">1</span>  <span class="hljs-number">7</span>
<span class="hljs-number">2</span>  <span class="hljs-number">7</span>  <span class="hljs-number">9</span>  <span class="hljs-number">9</span>
</code></pre>
<h5 id="3-dataframe&#x5408;&#x5E76;&#x65F6;&#x540C;&#x65F6;&#x67E5;&#x770B;&#x884C;&#x7D22;&#x5F15;&#x548C;&#x5217;&#x7D22;&#x5F15;&#x6709;&#x65E0;&#x91CD;&#x590D;">3) DataFrame&#x5408;&#x5E76;&#x65F6;&#x540C;&#x65F6;&#x67E5;&#x770B;&#x884C;&#x7D22;&#x5F15;&#x548C;&#x5217;&#x7D22;&#x5F15;&#x6709;&#x65E0;&#x91CD;&#x590D;</h5>
<p>&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-python">df_obj1 = pd.DataFrame(np.random.randint(<span class="hljs-number">0</span>, <span class="hljs-number">10</span>, (<span class="hljs-number">3</span>, <span class="hljs-number">2</span>)), index=[<span class="hljs-string">&apos;a&apos;</span>, <span class="hljs-string">&apos;b&apos;</span>, <span class="hljs-string">&apos;c&apos;</span>],
                       columns=[<span class="hljs-string">&apos;A&apos;</span>, <span class="hljs-string">&apos;B&apos;</span>])
df_obj2 = pd.DataFrame(np.random.randint(<span class="hljs-number">0</span>, <span class="hljs-number">10</span>, (<span class="hljs-number">2</span>, <span class="hljs-number">2</span>)), index=[<span class="hljs-string">&apos;a&apos;</span>, <span class="hljs-string">&apos;b&apos;</span>],
                       columns=[<span class="hljs-string">&apos;C&apos;</span>, <span class="hljs-string">&apos;D&apos;</span>])
print(df_obj1)
print(df_obj2)

print(pd.concat([df_obj1, df_obj2]))
print(pd.concat([df_obj1, df_obj2], axis=<span class="hljs-number">1</span>, join=<span class="hljs-string">&apos;inner&apos;</span>))
</code></pre>
<p>&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># print(df_obj1)</span>
   A  B
a  <span class="hljs-number">3</span>  <span class="hljs-number">3</span>
b  <span class="hljs-number">5</span>  <span class="hljs-number">4</span>
c  <span class="hljs-number">8</span>  <span class="hljs-number">6</span>

<span class="hljs-comment"># print(df_obj2)</span>
   C  D
a  <span class="hljs-number">1</span>  <span class="hljs-number">9</span>
b  <span class="hljs-number">6</span>  <span class="hljs-number">8</span>

<span class="hljs-comment"># print(pd.concat([df_obj1, df_obj2]))</span>
     A    B    C    D
a  <span class="hljs-number">3.0</span>  <span class="hljs-number">3.0</span>  NaN  NaN
b  <span class="hljs-number">5.0</span>  <span class="hljs-number">4.0</span>  NaN  NaN
c  <span class="hljs-number">8.0</span>  <span class="hljs-number">6.0</span>  NaN  NaN
a  NaN  NaN  <span class="hljs-number">1.0</span>  <span class="hljs-number">9.0</span>
b  NaN  NaN  <span class="hljs-number">6.0</span>  <span class="hljs-number">8.0</span>

<span class="hljs-comment"># print(pd.concat([df_obj1, df_obj2], axis=1, join=&apos;inner&apos;))</span>
   A  B  C  D
a  <span class="hljs-number">3</span>  <span class="hljs-number">3</span>  <span class="hljs-number">1</span>  <span class="hljs-number">9</span>
b  <span class="hljs-number">5</span>  <span class="hljs-number">4</span>  <span class="hljs-number">6</span>  <span class="hljs-number">8</span>
</code></pre>
<blockquote>
<h2 id="&#x6570;&#x636E;&#x91CD;&#x6784;">&#x6570;&#x636E;&#x91CD;&#x6784;</h2>
</blockquote>
<h4 id="1-stack">1. stack</h4>
<ul>
<li><p>&#x5C06;&#x5217;&#x7D22;&#x5F15;&#x65CB;&#x8F6C;&#x4E3A;&#x884C;&#x7D22;&#x5F15;&#xFF0C;&#x5B8C;&#x6210;&#x5C42;&#x7EA7;&#x7D22;&#x5F15;</p>
</li>
<li><p>DataFrame-&gt;Series</p>
</li>
</ul>
<p>&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd

df_obj = pd.DataFrame(np.random.randint(<span class="hljs-number">0</span>,<span class="hljs-number">10</span>, (<span class="hljs-number">5</span>,<span class="hljs-number">2</span>)), columns=[<span class="hljs-string">&apos;data1&apos;</span>, <span class="hljs-string">&apos;data2&apos;</span>])
print(df_obj)

stacked = df_obj.stack()
print(stacked)
</code></pre>
<p>&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># print(df_obj)</span>
   data1  data2
<span class="hljs-number">0</span>      <span class="hljs-number">7</span>      <span class="hljs-number">9</span>
<span class="hljs-number">1</span>      <span class="hljs-number">7</span>      <span class="hljs-number">8</span>
<span class="hljs-number">2</span>      <span class="hljs-number">8</span>      <span class="hljs-number">9</span>
<span class="hljs-number">3</span>      <span class="hljs-number">4</span>      <span class="hljs-number">1</span>
<span class="hljs-number">4</span>      <span class="hljs-number">1</span>      <span class="hljs-number">2</span>

<span class="hljs-comment"># print(stacked)</span>
<span class="hljs-number">0</span>  data1    <span class="hljs-number">7</span>
   data2    <span class="hljs-number">9</span>
<span class="hljs-number">1</span>  data1    <span class="hljs-number">7</span>
   data2    <span class="hljs-number">8</span>
<span class="hljs-number">2</span>  data1    <span class="hljs-number">8</span>
   data2    <span class="hljs-number">9</span>
<span class="hljs-number">3</span>  data1    <span class="hljs-number">4</span>
   data2    <span class="hljs-number">1</span>
<span class="hljs-number">4</span>  data1    <span class="hljs-number">1</span>
   data2    <span class="hljs-number">2</span>
dtype: int64
</code></pre>
<h4 id="2-unstack">2. unstack</h4>
<ul>
<li><p>&#x5C06;&#x5C42;&#x7EA7;&#x7D22;&#x5F15;&#x5C55;&#x5F00;</p>
</li>
<li><p>Series-&gt;DataFrame</p>
</li>
<li><p>&#x8BA4;&#x64CD;&#x4F5C;&#x5185;&#x5C42;&#x7D22;&#x5F15;&#xFF0C;&#x5373;level=-1</p>
</li>
</ul>
<p>&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># &#x9ED8;&#x8BA4;&#x64CD;&#x4F5C;&#x5185;&#x5C42;&#x7D22;&#x5F15;</span>
print(stacked.unstack())

<span class="hljs-comment"># &#x901A;&#x8FC7;level&#x6307;&#x5B9A;&#x64CD;&#x4F5C;&#x7D22;&#x5F15;&#x7684;&#x7EA7;&#x522B;</span>
print(stacked.unstack(level=<span class="hljs-number">0</span>))
</code></pre>
<p>&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># print(stacked.unstack())</span>
   data1  data2
<span class="hljs-number">0</span>      <span class="hljs-number">7</span>      <span class="hljs-number">9</span>
<span class="hljs-number">1</span>      <span class="hljs-number">7</span>      <span class="hljs-number">8</span>
<span class="hljs-number">2</span>      <span class="hljs-number">8</span>      <span class="hljs-number">9</span>
<span class="hljs-number">3</span>      <span class="hljs-number">4</span>      <span class="hljs-number">1</span>
<span class="hljs-number">4</span>      <span class="hljs-number">1</span>      <span class="hljs-number">2</span>

<span class="hljs-comment"># print(stacked.unstack(level=0))</span>
       <span class="hljs-number">0</span>  <span class="hljs-number">1</span>  <span class="hljs-number">2</span>  <span class="hljs-number">3</span>  <span class="hljs-number">4</span>
data1  <span class="hljs-number">7</span>  <span class="hljs-number">7</span>  <span class="hljs-number">8</span>  <span class="hljs-number">4</span>  <span class="hljs-number">1</span>
data2  <span class="hljs-number">9</span>  <span class="hljs-number">8</span>  <span class="hljs-number">9</span>  <span class="hljs-number">1</span>  <span class="hljs-number">2</span>
</code></pre>
<blockquote>
<h2 id="&#x6570;&#x636E;&#x8F6C;&#x6362;">&#x6570;&#x636E;&#x8F6C;&#x6362;</h2>
</blockquote>
<h3 id="&#x4E00;&#x3001;-&#x5904;&#x7406;&#x91CD;&#x590D;&#x6570;&#x636E;">&#x4E00;&#x3001; &#x5904;&#x7406;&#x91CD;&#x590D;&#x6570;&#x636E;</h3>
<h4 id="1-duplicated-&#x8FD4;&#x56DE;&#x5E03;&#x5C14;&#x578B;series&#x8868;&#x793A;&#x6BCF;&#x884C;&#x662F;&#x5426;&#x4E3A;&#x91CD;&#x590D;&#x884C;">1 <code>duplicated()</code> &#x8FD4;&#x56DE;&#x5E03;&#x5C14;&#x578B;Series&#x8868;&#x793A;&#x6BCF;&#x884C;&#x662F;&#x5426;&#x4E3A;&#x91CD;&#x590D;&#x884C;</h4>
<p>&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd

df_obj = pd.DataFrame({<span class="hljs-string">&apos;data1&apos;</span> : [<span class="hljs-string">&apos;a&apos;</span>] * <span class="hljs-number">4</span> + [<span class="hljs-string">&apos;b&apos;</span>] * <span class="hljs-number">4</span>,
                       <span class="hljs-string">&apos;data2&apos;</span> : np.random.randint(<span class="hljs-number">0</span>, <span class="hljs-number">4</span>, <span class="hljs-number">8</span>)})
print(df_obj)

print(df_obj.duplicated())
</code></pre>
<p>&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># print(df_obj)</span>
  data1  data2
<span class="hljs-number">0</span>     a      <span class="hljs-number">3</span>
<span class="hljs-number">1</span>     a      <span class="hljs-number">2</span>
<span class="hljs-number">2</span>     a      <span class="hljs-number">3</span>
<span class="hljs-number">3</span>     a      <span class="hljs-number">3</span>
<span class="hljs-number">4</span>     b      <span class="hljs-number">1</span>
<span class="hljs-number">5</span>     b      <span class="hljs-number">0</span>
<span class="hljs-number">6</span>     b      <span class="hljs-number">3</span>
<span class="hljs-number">7</span>     b      <span class="hljs-number">0</span>

<span class="hljs-comment"># print(df_obj.duplicated())</span>
<span class="hljs-number">0</span>    <span class="hljs-keyword">False</span>
<span class="hljs-number">1</span>    <span class="hljs-keyword">False</span>
<span class="hljs-number">2</span>     <span class="hljs-keyword">True</span>
<span class="hljs-number">3</span>     <span class="hljs-keyword">True</span>
<span class="hljs-number">4</span>    <span class="hljs-keyword">False</span>
<span class="hljs-number">5</span>    <span class="hljs-keyword">False</span>
<span class="hljs-number">6</span>    <span class="hljs-keyword">False</span>
<span class="hljs-number">7</span>     <span class="hljs-keyword">True</span>
dtype: bool
</code></pre>
<h4 id="2-dropduplicates-&#x8FC7;&#x6EE4;&#x91CD;&#x590D;&#x884C;">2 <code>drop_duplicates()</code> &#x8FC7;&#x6EE4;&#x91CD;&#x590D;&#x884C;</h4>
<blockquote>
<p>&#x9ED8;&#x8BA4;&#x5224;&#x65AD;&#x5168;&#x90E8;&#x5217;</p>
<p>&#x53EF;&#x6307;&#x5B9A;&#x6309;&#x67D0;&#x4E9B;&#x5217;&#x5224;&#x65AD;</p>
</blockquote>
<p>&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-python">print(df_obj.drop_duplicates())
print(df_obj.drop_duplicates(<span class="hljs-string">&apos;data2&apos;</span>))
</code></pre>
<p>&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># print(df_obj.drop_duplicates())</span>
  data1  data2
<span class="hljs-number">0</span>     a      <span class="hljs-number">3</span>
<span class="hljs-number">1</span>     a      <span class="hljs-number">2</span>
<span class="hljs-number">4</span>     b      <span class="hljs-number">1</span>
<span class="hljs-number">5</span>     b      <span class="hljs-number">0</span>
<span class="hljs-number">6</span>     b      <span class="hljs-number">3</span>

<span class="hljs-comment"># print(df_obj.drop_duplicates(&apos;data2&apos;))</span>
  data1  data2
<span class="hljs-number">0</span>     a      <span class="hljs-number">3</span>
<span class="hljs-number">1</span>     a      <span class="hljs-number">2</span>
<span class="hljs-number">4</span>     b      <span class="hljs-number">1</span>
<span class="hljs-number">5</span>     b      <span class="hljs-number">0</span>
</code></pre>
<h4 id="3-&#x6839;&#x636E;map&#x4F20;&#x5165;&#x7684;&#x51FD;&#x6570;&#x5BF9;&#x6BCF;&#x884C;&#x6216;&#x6BCF;&#x5217;&#x8FDB;&#x884C;&#x8F6C;&#x6362;">3. &#x6839;&#x636E;<code>map</code>&#x4F20;&#x5165;&#x7684;&#x51FD;&#x6570;&#x5BF9;&#x6BCF;&#x884C;&#x6216;&#x6BCF;&#x5217;&#x8FDB;&#x884C;&#x8F6C;&#x6362;</h4>
<ul>
<li>Series&#x6839;&#x636E;<code>map</code>&#x4F20;&#x5165;&#x7684;&#x51FD;&#x6570;&#x5BF9;&#x6BCF;&#x884C;&#x6216;&#x6BCF;&#x5217;&#x8FDB;&#x884C;&#x8F6C;&#x6362;</li>
</ul>
<p>&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-python">ser_obj = pd.Series(np.random.randint(<span class="hljs-number">0</span>,<span class="hljs-number">10</span>,<span class="hljs-number">10</span>))
print(ser_obj)

print(ser_obj.map(<span class="hljs-keyword">lambda</span> x : x ** <span class="hljs-number">2</span>))
</code></pre>
<p>&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># print(ser_obj)</span>
<span class="hljs-number">0</span>    <span class="hljs-number">1</span>
<span class="hljs-number">1</span>    <span class="hljs-number">4</span>
<span class="hljs-number">2</span>    <span class="hljs-number">8</span>
<span class="hljs-number">3</span>    <span class="hljs-number">6</span>
<span class="hljs-number">4</span>    <span class="hljs-number">8</span>
<span class="hljs-number">5</span>    <span class="hljs-number">6</span>
<span class="hljs-number">6</span>    <span class="hljs-number">6</span>
<span class="hljs-number">7</span>    <span class="hljs-number">4</span>
<span class="hljs-number">8</span>    <span class="hljs-number">7</span>
<span class="hljs-number">9</span>    <span class="hljs-number">3</span>
dtype: int64

<span class="hljs-comment"># print(ser_obj.map(lambda x : x ** 2))</span>
<span class="hljs-number">0</span>     <span class="hljs-number">1</span>
<span class="hljs-number">1</span>    <span class="hljs-number">16</span>
<span class="hljs-number">2</span>    <span class="hljs-number">64</span>
<span class="hljs-number">3</span>    <span class="hljs-number">36</span>
<span class="hljs-number">4</span>    <span class="hljs-number">64</span>
<span class="hljs-number">5</span>    <span class="hljs-number">36</span>
<span class="hljs-number">6</span>    <span class="hljs-number">36</span>
<span class="hljs-number">7</span>    <span class="hljs-number">16</span>
<span class="hljs-number">8</span>    <span class="hljs-number">49</span>
<span class="hljs-number">9</span>     <span class="hljs-number">9</span>
dtype: int64
</code></pre>
<h3 id="&#x4E8C;&#x3001;&#x6570;&#x636E;&#x66FF;&#x6362;">&#x4E8C;&#x3001;&#x6570;&#x636E;&#x66FF;&#x6362;</h3>
<h4 id="replace&#x6839;&#x636E;&#x503C;&#x7684;&#x5185;&#x5BB9;&#x8FDB;&#x884C;&#x66FF;&#x6362;"><code>replace</code>&#x6839;&#x636E;&#x503C;&#x7684;&#x5185;&#x5BB9;&#x8FDB;&#x884C;&#x66FF;&#x6362;</h4>
<p>&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># &#x5355;&#x4E2A;&#x503C;&#x66FF;&#x6362;&#x5355;&#x4E2A;&#x503C;</span>
print(ser_obj.replace(<span class="hljs-number">1</span>, -<span class="hljs-number">100</span>))

<span class="hljs-comment"># &#x591A;&#x4E2A;&#x503C;&#x66FF;&#x6362;&#x4E00;&#x4E2A;&#x503C;</span>
print(ser_obj.replace([<span class="hljs-number">6</span>, <span class="hljs-number">8</span>], -<span class="hljs-number">100</span>))

<span class="hljs-comment"># &#x591A;&#x4E2A;&#x503C;&#x66FF;&#x6362;&#x591A;&#x4E2A;&#x503C;</span>
print(ser_obj.replace([<span class="hljs-number">4</span>, <span class="hljs-number">7</span>], [-<span class="hljs-number">100</span>, -<span class="hljs-number">200</span>]))
</code></pre>
<p>&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># print(ser_obj.replace(1, -100))</span>
<span class="hljs-number">0</span>   -<span class="hljs-number">100</span>
<span class="hljs-number">1</span>      <span class="hljs-number">4</span>
<span class="hljs-number">2</span>      <span class="hljs-number">8</span>
<span class="hljs-number">3</span>      <span class="hljs-number">6</span>
<span class="hljs-number">4</span>      <span class="hljs-number">8</span>
<span class="hljs-number">5</span>      <span class="hljs-number">6</span>
<span class="hljs-number">6</span>      <span class="hljs-number">6</span>
<span class="hljs-number">7</span>      <span class="hljs-number">4</span>
<span class="hljs-number">8</span>      <span class="hljs-number">7</span>
<span class="hljs-number">9</span>      <span class="hljs-number">3</span>
dtype: int64

<span class="hljs-comment"># print(ser_obj.replace([6, 8], -100))</span>
<span class="hljs-number">0</span>      <span class="hljs-number">1</span>
<span class="hljs-number">1</span>      <span class="hljs-number">4</span>
<span class="hljs-number">2</span>   -<span class="hljs-number">100</span>
<span class="hljs-number">3</span>   -<span class="hljs-number">100</span>
<span class="hljs-number">4</span>   -<span class="hljs-number">100</span>
<span class="hljs-number">5</span>   -<span class="hljs-number">100</span>
<span class="hljs-number">6</span>   -<span class="hljs-number">100</span>
<span class="hljs-number">7</span>      <span class="hljs-number">4</span>
<span class="hljs-number">8</span>      <span class="hljs-number">7</span>
<span class="hljs-number">9</span>      <span class="hljs-number">3</span>
dtype: int64

<span class="hljs-comment"># print(ser_obj.replace([4, 7], [-100, -200]))</span>
<span class="hljs-number">0</span>      <span class="hljs-number">1</span>
<span class="hljs-number">1</span>   -<span class="hljs-number">100</span>
<span class="hljs-number">2</span>      <span class="hljs-number">8</span>
<span class="hljs-number">3</span>      <span class="hljs-number">6</span>
<span class="hljs-number">4</span>      <span class="hljs-number">8</span>
<span class="hljs-number">5</span>      <span class="hljs-number">6</span>
<span class="hljs-number">6</span>      <span class="hljs-number">6</span>
<span class="hljs-number">7</span>   -<span class="hljs-number">100</span>
<span class="hljs-number">8</span>   -<span class="hljs-number">200</span>
<span class="hljs-number">9</span>      <span class="hljs-number">3</span>
dtype: int64
</code></pre>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; BigCat all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x300C;Revision Time:
2017-03-14 01:52:05&#x300D;
</span></footer>
                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../../file/part03/3.7.html" class="navigation navigation-prev " aria-label="Previous page: Pandas分组与聚合"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../../file/part03/3.9.html" class="navigation navigation-next " aria-label="Next page: 聚类模型 -- K-Means介绍"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../../gitbook/app.js"></script>

    
    <script src="../../gitbook/plugins/gitbook-plugin-splitter/splitter.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-livereload/plugin.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"disqus":{"shortName":"gitbookuse"},"github":{"url":"https://github.com/dododream"},"search-pro":{"cutWordLib":"nodejieba","defineWord":["gitbook-use"]},"sharing":{"weibo":true,"facebook":true,"twitter":true,"google":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"tbfed-pagefooter":{"copyright":"Copyright © BigCat","modify_label":"「Revision Time:","modify_format":"YYYY-MM-DD HH:mm:ss」"},"baidu":{"token":"ff100361cdce95dd4c8fb96b4009f7bc"},"sitemap":{"hostname":"http://www.treenewbee.top"},"donate":{"wechat":"http://weixin.png","alipay":"http://alipay.png","title":"","button":"赏","alipayText":"支付宝打赏","wechatText":"微信打赏"},"edit-link":{"base":"https://github.com/dododream/edit","label":"Edit This Page"},"splitter":{},"toggle-chapters":{},"highlight":{},"fontsettings":{"theme":"white","family":"sans","size":2},"livereload":{}};
    gitbook.start(config);
});
</script>

        <!-- body:end -->
    </body>
    <!-- End of book Python数据分析课程讲义 -->
</html>
